from django.db import models

# Create your models here.
from django.db import models

#员工类,信息展示在主页面
class Employee(models.Model):

    e_name=models.CharField(max_length=500)
    photo=models.ImageField(upload_to="pic",default="")
    salary=models.DecimalField(max_digits=20,decimal_places=2) #后者是小数位数
    age=models.IntegerField()

    class Meta:
        # managed = False
        db_table = 'ems_employee'
        verbose_name="员工"
        verbose_name_plural=verbose_name

    def __str__(self):
        return    self.e_name




#管理员类,登录注册
class User(models.Model):
    u_name = models.CharField(max_length=100, blank=True, null=False )
    password = models.CharField(max_length=300, blank=True, null=True)
    #定义状态,为了
    status=models.SmallIntegerField(default=False)

    #下面的暂时不用
    email = models.CharField(max_length=300, blank=True, null=True)
    active = models.IntegerField(blank=True, null=True)   #邮箱是否激活
    salt = models.CharField(max_length=300, blank=True, null=True)

    class Meta:
        # managed = False
        # unique_together=(('name'),)    #设置唯一,在注册时,用户名重复直接注册不了,这里有问题
        verbose_name="用户"
        verbose_name_plural=verbose_name
        db_table = 'ems_user'
    def __str__(self):
        return self.u_name
